package com.ruoyi.system.domain.temple;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.ToString;

import java.math.BigDecimal;

/**
 * @author zhl
 * @descript 描述
 * @date 2024/4/19 10:07
 */
@Data
@ToString
public class IndirectTemple {
    private static final long serialVersionUID = 1L;

    @ExcelIgnore
    private Long id;

    @ExcelProperty(value = "序号")
    @ColumnWidth(8)
    private Long no = 1L;

    @Excel(name = "费用明细")
    @ExcelProperty(value = "费用明细")
    @ColumnWidth(15)
    private String indirectName = "费用明细";

    /**
     * 项目名称
     */
    @ExcelIgnore
    private String projectName;

    /**
     * 项目编号
     */
//    @Excel(name = "项目编号")
//    @ExcelProperty(value = "项目编号")
//    @ColumnWidth(15)
    @ExcelIgnore
    private String projectCode;

    /**
     * 间接明细id
     */
    //@Excel(name = "间接明细id")
    @ExcelIgnore
    private Integer nameId = 1;

    /**
     * 账面工程施工借方发生额合计（不含税）
     */
    @Excel(name = "账面工程施工借方发生额合计（不含税）")
    @ExcelProperty(value = "账面工程施工借方发生额合计（不含税）")
    @ColumnWidth(20)
    private BigDecimal totalNoTax = new BigDecimal("1000000.00");

    /**
     * 已收账款
     */
    @Excel(name = "已收账款")
    @ExcelProperty(value = "已收账款")
    @ColumnWidth(20)
    private BigDecimal received = new BigDecimal("1000000.00");

    /**
     * 实际已发生的成本
     */
    @Excel(name = "实际已发生的成本")
    @ExcelProperty(value = "实际已发生的成本")
    @ColumnWidth(20)
    private BigDecimal realTotalWithTax = new BigDecimal("1000000.00");

    /**
     * 预计总成本
     */
    @Excel(name = "预计总成本")
    @ExcelProperty(value = "预计总成本")
    @ColumnWidth(20)
    private BigDecimal contractWithTax = new BigDecimal("1000000.00");

    /**
     * 备注
     */
    @ExcelProperty(value = "备注")
    @ColumnWidth(20)
    private String remark;



    public void setIndirectName() {
        switch (nameId) {
            case 1:
                indirectName = "财务费用";
                break;
            case 2:
                indirectName = "人工费";
                break;
            case 3:
                indirectName = "业务招待费";
                break;
            case 4:
                indirectName = "其它费用";
                break;
            case 5:
                indirectName = "办公费";
                break;
            case 6:
                indirectName = "安全文明措施费";
                break;
            case 7:
                indirectName = "低值易耗品摊销";
                break;
            default:
                indirectName = "未定义费用";
                break;
        }
    }

    public void setNameId(Integer nameId) {
        this.nameId = nameId;
        setIndirectName();
    }

    public Integer getNameId(String indirectName) {
        switch (indirectName) {
            case "财务费用":
                nameId = 1;
                break;
            case "人工费":
                nameId = 2;
                break;
            case "业务招待费":
                nameId = 3;
                break;
            case "其它费用":
                nameId = 4;
                break;
            case "办公费":
                nameId = 5;
                break;
            case "安全文明措施费":
                nameId = 6;
                break;
            case "低值易耗品摊销":
                nameId = 7;
                break;
            default:
                nameId = 0;
                break;
        }
        return nameId;
    }
}
